<?php
$cols=implode(',',array_map('mysql_real_escape_string',$cols));
$table=mysql_real_escape_string($table);
$limit=isset($limit)?mysql_real_escape_string($limit):'';
$q=$db->prepare("select $cols from $table $limit");
$q->execute();
 
if($q->rowCount()){ while($row=$q->fetch())$funk($row); }
else if(isset($empty))echo$empty;

/*
unset($fields);
unset($table);
unset($limit);
unset($q);
*/
?>